package com.gin.kotlin.no_gay_alliance.adapter.emoji

import android.content.Context
import com.gin.kotlin.no_gay_alliance.base.AbstractBindingRecyclerViewAdapter
import com.gin.kotlin.no_gay_alliance.base.MyHandler
import com.gin.kotlin.no_gay_alliance.databinding.ItemEmojiPackageBinding
import com.gin.kotlin.no_gay_alliance.model.emoji.GenericEmojiPackage

class GenericEmojiPackageAdapter(context: Context, handler: MyHandler, data: MutableList<GenericEmojiPackage> = mutableListOf()) :
    AbstractBindingRecyclerViewAdapter<ItemEmojiPackageBinding, GenericEmojiPackage>(context, handler, false, data) {
    override fun onBindViewHolder(holder: ViewHolder<ItemEmojiPackageBinding>, position: Int, b: ItemEmojiPackageBinding, dataModel: GenericEmojiPackage) {
        b.tvEmojiPackageName.text = dataModel.name
        b.recyclerViewEmojiGroup.adapter = b.recyclerViewEmojiGroup.adapter ?: GenericEmojiGroupAdapter(
            context, handler,
            data = dataModel.groups?.toMutableList() ?: mutableListOf()
        )
    }

}